package com.mmp.main.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
 * The persistent class for the sys_role_group database table.
 *
 */
@Entity
@Table(name = "sys_role_group")
@NamedQuery(name = "SysRoleGroup.findAll", query = "SELECT s FROM SysRoleGroup s")
public class SysRoleGroup implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Basic(optional = false)
	private Integer id;

	private String dest_URL;

	@Column(name = "display_name")
	private String displayName;

	@Column(name = "display_order")
	private Integer displayOrder;

	// bi-directional many-to-one association to SysRole
	@LazyCollection(LazyCollectionOption.FALSE)
	@OneToMany(mappedBy = "sysRoleGroup")
	private List<SysRole> sysRoles;

	public SysRoleGroup() {
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getDest_URL() {
		return this.dest_URL;
	}

	public void setDest_URL(String dest_URL) {
		this.dest_URL = dest_URL;
	}

	public String getDisplayName() {
		return this.displayName;
	}

	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}

	public Integer getDisplayOrder() {
		return this.displayOrder;
	}

	public void setDisplayOrder(Integer displayOrder) {
		this.displayOrder = displayOrder;
	}

	public List<SysRole> getSysRoles() {
		return this.sysRoles;
	}

	public void setSysRoles(List<SysRole> sysRoles) {
		this.sysRoles = sysRoles;
	}

	public SysRole addSysRole(SysRole sysRole) {
		getSysRoles().add(sysRole);
		sysRole.setSysRoleGroup(this);

		return sysRole;
	}

	public SysRole removeSysRole(SysRole sysRole) {
		getSysRoles().remove(sysRole);
		sysRole.setSysRoleGroup(null);

		return sysRole;
	}

}
